#include<stdio.h>
int main()
{
	int N=0,mid=0;
	scanf("%d",&N);
    int left=0,right=N;
    int a[N];
    for(int i=0;i<N;i++)
    {
    	scanf("%d",&a[i]);
	}
	int flag=0;
	scanf("%d",&flag);
	while(left<=right)
	{
		mid=(left+right)/2;
		if(a[mid]>flag)
		{
			right=mid-1;
		}
		else if(a[mid]<flag)
		{
			left=mid+1;
		}
		else
	    break;
	}
	printf("%d",mid);
} 
